package design_pattern.observer.jdkObserver;

import lombok.Data;

import java.util.Observable;

/**
 * Observer对象是观察者，Observable对象是被观察者。
 */
@Data
public class Wolf extends Observable {

    private String name;

    Wolf(String name) {
        this.name = name;
    }

    public void cry(WolfState state) {
        System.out.println(this.getName() + " crying " + state.toString());
        this.setChanged();
        this.notifyObservers(state);
    }

}